package com.itheima.demo02;

import java.util.ArrayList;

public class AlgorithmTest01 {
    public static void main(String[] args) {
        int[] arr = {123, 23, 345, 56, 77, 87, 122, 44, 66, 77, 99,123};
        int num = 123;
        System.out.println(getIndex(arr, num));
    }

    private static ArrayList<Integer> getIndex(int[] arr, int num) {
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] == num) {
                list.add(i);
            }
        }

        return list;
    }
}
